<h4>Komentáře k objednávce</h4>

  <% unless f.object.comments.blank? %>
    <table class="table" style="margin-bottom: 12px;">
        <thead>
          <tr>
            <th class="first" colspan="2"><%= "#{t 'helpers.label.comment.comment'}" %></th>
            <th><%= "#{t 'helpers.label.comment.created_at'}" %></th>
            <th><%= "#{t 'helpers.label.comment.user_id'}" %></th>
            <th class="last" style="width: 20px;"></th>
          </tr>
        </thead>
        <tbody>
          <%= f.fields_for :comments, :validate => false do |comment| %>
            <tr>
              <td colspan="2"><%= comment.object.comment %></td>
              <td><%= raw(l comment.object.created_at, :format => :short) %></td>
              <td><%= comment.object.user.blank? ? "Neuveden" : "#{comment.object.user.user_info.whole_name}" %></td>
              <td>
                <% permitted_to? :destroy, :admin_comments do %>
                  <%= button_to_delete "X", admin_comment_path(comment.object.id) %>
                <% end %>
              </td>
            </tr>
          <% end %>
      </tbody>
    </table>
  <% end %>

  <%= f.fields_for :comments, f.object.comments.build do |comment| %>
    <table>
      <tfoot>
        <tr>
          <th colspan="2"><%= comment.submit %></th>
        </tr>
      </tfoot>
      <tbody>
        <tr>
          <th><%= comment.label :comment %></th>
          <td><%= comment.text_area :comment, :style => "width: 400px; height: 40px;" %></td>
        </tr>
      </tbody>
    </table>
  <% end %>